ActiveReports Developer 7
Drill-Through Reports
See Also Support Forum
ActiveReports Developer 7 > ActiveReports Developer Guide > Samples and Walkthroughs > Walkthroughs > Page Report Walkthroughs > Interactive Reports > Drill-Through Reports

Glossary Item Box

The following procedures illustrate how to create a drill-through link to another report containing details about the linked item.

The walkthrough is split into the following activities:

Note: This walkthrough uses tables from the Reels database. By default, in ActiveReports Developer, the Reels.mdb file is located in the [User Documents folder]\ComponentOne Samples\ActiveReports Developer 7\Data folder.

When you complete this walkthrough you get a layout that looks similar to the following at runtime.

Runtime Layout (main report)


Runtime Layout (detail report)


ShowTo create the main report

  1. Create a new Visual Studio project.
  2. From the Visual Studio Project menu, select Add New Item.
  3. In the Add New Item dialog that appears, select ActiveReports 7 Page Report and in the Name field, rename the file as MainReport.rdlx.
  4. Click the Add button to open a new page report in the designer.

ShowTo connect the main report to a data source and add a dataset

  1. In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
  2. In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like MainReportData.
  3. On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.
  4. In the Report Explorer, right-click the data source node and select the Add Data Set option.
  5. In the DataSet Dialog that appears, select the General page and enter the name of the dataset as Movie. This name appears as a child node to the data source icon in the Report Explorer.
  6. On the Query page of this dialog, in the Query field enter the following SQL query.
    SQL Query Copy Code
    SELECT * FROM Movie ORDER BY MovieID ASC
    
  7. Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.

  8. Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.

ShowTo create a layout for the main report

  1. In the Visual Studio toolbox, go to the ActiveReports 7 Page Report tab and drag a TextBox control onto the design surface.
  2. Select the TextBox control and go to the Properties window to set the following properties.
    Property Name Property Value
    Location 0.75in, 0.125in
    Font Normal, Arial, 18pt, Bold
    Size 5in, 0.5in
    TextAlign Center
    Value MOVIES INFORMATION
  3. From the Visual Studio toolbox, drag a Table data region and place it on the design surface.
  4. Select the Table and go to the Properties window to set the following properties.
    Property Name Property Value
    Location 0in, 1.125in
    FixedSize 6.5in, 7in
    BorderStyle Solid
    RepeatHeaderOnNewPage True
    Size 6.5in, 0.75in
  5. In the Table data region, place your mouse over the cells of the table details row to display the field selection adorner.
  6. Click the adorner to show a list of available fields from the DataSet and add the following fields to the cells of the table details row.

    Cell Field
    Left Cell MovieID
    Middle Cell Title
    Right Cell YearReleased
    This automatically places an expression in the details row and simultaneously places a static label in the header row of the same column.
    Tip: You can also directly drag fields from the Report Explorer onto the textbox cells of the Table data region.
  7. Select the following table rows and go to the Properties window to set their properties.

    ShowTable Header

    Property Name Property Value
    BorderStyle Solid
    Font Normal, Arial, 12pt, Bold
    TextAlign Center

    ShowTable Details

    Property Name Property Value
    BorderStyle Solid
    Font Normal, Arial, 10pt, Bold
    TextAlign Center

ShowTo create the detail report

  1. From the Visual Studio Project menu, select Add New Item.
  2. In the Add New Item dialog that appears, select ActiveReports 7 Page Report and in the Name field, rename the file as MovieDetails.rdlx.
  3. Click the Add button to open a new page report in the designer.

ShowTo connect the detail report to a data source

  1. In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
  2. In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like ReportData.
  3. On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.

ShowTo add a dataset with a parameter

  1. In the Report Explorer, right-click the data source node and select the Add Data Set option.
  2. In the DataSet Dialog that appears, select the General page and enter the name of the dataset as MovieInfo. This name appears as a child node to the data source icon in the Report Explorer.
  3. On the Parameters page under Parameter Name enter MovieID.
  4. Under Value enter =Parameters!MovieID.Value
  5. On the Query page of this dialog, in the Query field enter the following SQL query.
    SQL Query Copy Code
    Select * from MovieCastInformation
    
  6. Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.

  7. Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.
  8. In an FPL report, set the Dataset name in the FixedPage dialog > General tab to MovieInfo. For more information, see FixedPage Dialog.
Caution: In an FPL report, you may get an error if the Dataset name for the FixedPage is not be specified explicitly.

ShowTo add a dataset to populate the parameter values

  1. In the Report Explorer, right-click the data source node and select the Add Data Set option.
  2. In the DataSet Dialog that appears, select the General page and enter the name of the dataset as MovieTitles. This name appears as a child node to the data source icon in the Report Explorer.
  3. On the Query page of this dialog, in the Query field enter the following SQL query.
    SQL Query Copy Code
    SELECT MovieID, Title FROM Movie ORDER BY Title ASC
    
  4. Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.

  5. Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.

ShowTo add a parameter to the report

  1. In the Report Explorer, select the Parameters node.
  2. Right-click the node and select Add Parameter to open the Report - Parameters dialog.
  3. Set properties in the following fields below the parameters list.

    In the General tab:

    • Name: MovieID
    • DataType: Integer

    In the Available Values tab select From query:

    • DataSet: MovieTitles
    • Value: MovieID
    • Label: Title
  4. Click OK to close the dialog and add the parameter to the collection. This parameter appears under the Parameters node in the Report Explorer.

ShowTo create a layout for the detail report

  1. Click the gray area below the design surface to select the report.
  2. Go to the Properties window, expand the PageSize property and set the Width to 8.5in and Height to 3in.
  3. From the toolbox, drag a List control onto the design surface and in the Properties window, set the following properties:
    Property Name Property Value
    DataSetName MovieInfo
    Location 0in, 0in
    Name MovieList
    Size 6.5in, 1in
    FixedSize (only for FPL reports) 6.5in, 1in
  4. With the List control selected, at the bottom of the Properties Window, select the Property dialog command.
  5. In the List dialog that appears, on the Detail Grouping page, set the Group on: Expression to =Fields!MovieID.Value.
  6. Click OK to close the dialog.
  7. From the Report Explorer, go to the MovieInfo dataset and drag the following five fields onto the MovieList data region. In the properties window, set their properties as indicated.

    ShowTitle

    Property Name Property Value
    Name MovieTitle
    Location 0in, 0in
    Size 6.5in, 0.375in
    TextAlign Center
    FontSize 14pt

    ShowYearReleased

    Property Name Property Value
    Name YearReleased
    Location 1in, 0.375in
    Size 0.75in, 0.25in
    TextAlign Left

    ShowMPAA

    Property Name Property Value
    Name MPAA
    Location 6in, 0.375in
    Size 0.5in, 0.25in

    ShowUserRating

    Property Name Property Value
    Name UserRating
    Location 1in, 0.625in
    Size 0.25in, 0.25in
    TextAlign Left

    ShowLength

    Property Name Property Value
    Name Length
    Location 4.75in, 0.625in
    Size 1.75in, 0.25in
    TextAlign Left
    Value =Fields!Length.Value & " minutes"
    Note: When you drag and drop fields from a dataset in the Report Explorer onto the design surface, these fields are automatically converted to Textbox controls that you can modify by setting the control properties in the Properties Window.
  8. From the Report Explorer, drag four TextBox controls onto the MovieList data region and in the properties window, set their properties as indicated.

    ShowTextBox1

    Property Name Property Value
    Location 0in, 0.375in
    Size 1in, 0.25in
    Name ReleaseLabel
    Value Released in:
    FontWeight Bold

    ShowTextBox2

    Property Name Property Value
    Location 3.625in, 0.375in
    Size 1.875in, 0.25in
    Name MPAALabel
    Value The MPAA rated this film:
    FontWeight Bold

    ShowTextBox3

    Property Name Property Value
    Location 0in, 0.625in
    Size 1in, 0.25in
    Name UserRatingLabel
    Value User rating:
    FontWeight Bold

    ShowTextBox4

    Property Name Property Value
    Location 4.125in, 0.625in
    Size 0.625in, 0.25in
    Name LengthLabel
    Value Length:
    FontWeight Bold

ShowTo add a drill-through link to the main report

  1. On the design surface, select the cell containing the Title field inside the table data region and at the bottom of the Properties Window, click the Property dialog command.
  2. In the Textbox dialog that appears, go to the Navigation page.
  3. Under Action, select Jump to report and set the report name MovieDetails.rdlx.
  4. Under Jump to report set the Name of the parameter to MovieID.
    Caution: The parameter name must exactly match the parameter in the target report.
  5. Set the Value to =Fields!MovieID.Value.
  6. Click OK to close the dialog.

ShowTo view the report

Open the report in the Viewer. See Using the Viewer for further information.

See Also

©2014. ComponentOne, a division of GrapeCity. All rights reserved.